/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Pham Thanh
 */
public class Regex {
    public static void main(String argv[]){
               Pattern p = Pattern.compile("(\\b((www)|(\\bhttp)|(\\bftp)|(\\bfile))[^ \\),;]*)|([^ ]*.net)([^ ]*.org)|([^ ]*.vn)|([^ ]*.com)|([^ ]+@[^ ]+)|(\\b(\\d[\\d\\.,\\p{Pd} ]*)?\\d[ ]?((AUD)|(SGD)|(USD)|(VNĐ)|(Đ\\b)|(đ\\b)|(đồng\\b)|(\\$)|(S\\$)))|(\\b((AUD)|(SGD)|(USD)|(VNĐ)|(Đ\\b)|(\\$)|(S\\$))[ ]?(\\d[\\d\\.,\\p{Pd} ]*)?\\d)|(\\b([\\d]+:)+\\d+)|([\\d]+[,][\\d]+([ ]?\\p{Pd}[ ]?[\\d]+([,]?[\\d]+)?)?)|(\\b((\\(\\d+\\))|(\\d))[\\d\\.\\p{Pd} /\\)]*\\d)|(\\b(\\p{Lu}\\.)+(\\p{Lu}))");
        Matcher m=p.matcher("-11,9");

        System.out.println("package test; class Regex");

        while(m.find()){
            String abc=m.group();
            int start=m.start();
            int end =m.end();
            System.out.println("abc: "+abc+" "+start+" "+end);
        }
    }

}
